﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c="clr-namespace:ChristianMoser.WpfInspector.UserInterface.Controls">

    <!-- PopupContentControl: [Default] -->
    <Style TargetType="{x:Type c:PopupContentControl}">
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Background" Value="{DynamicResource DefaultBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource DefaultBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="CornerRadius" Value="3" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type c:PopupContentControl}">

                    <Grid x:Name="MainGrid" SnapsToDevicePixels="True" ClipToBounds="False">
                        <Border Name="PART_Header" Background="Transparent">
                            <Border Background="{TemplateBinding Background}" 
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="{TemplateBinding CornerRadius}"
                                BorderBrush="{TemplateBinding BorderBrush}">
                                <ToggleButton Grid.Column="2" Template="{DynamicResource ComboBoxToggleButton}" x:Name="ToggleButton" Focusable="false" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press">
                                    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                                              IsHitTestVisible="False" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                              Content="{TemplateBinding Header}" />
                                </ToggleButton>
                            </Border>
                        </Border>
                        <Popup x:Name="PART_Popup" PlacementTarget="{Binding ElementName=PART_Header}"
                               IsOpen="{Binding IsDropDownOpenResolved, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
                               Placement="Bottom" AllowsTransparency="True" PopupAnimation="Slide" >
                            <Border BorderThickness="1" CornerRadius="3" BorderBrush="{DynamicResource DefaultBorderBrush}" Background="{DynamicResource LightBackgroundBrush}" >
                                <Grid x:Name="grid" Margin="2" >
                                    <ContentPresenter />
                                </Grid>
                            </Border>
                        </Popup>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>